//
// Created by bangsun on 2022/11/11.
//


#ifndef LOUTINE_DEQUE_H
#define LOUTINE_DEQUE_H

#include "util.h"


#define DEFAULT_CAPACITY (1<<6)

// array implemented deque
struct deque {
    int capacity, size;
    void **data;
    int head, tail;
};



typedef struct deque deque;

deque *create_deque();

void init_deque(deque *deque);

void free_deque(deque *deque);

int expand_deque(deque *deque);

int add_last(deque *deque, void *val);

int add_first(deque *deque, void *val);

void *poll_last(deque *deque);

void *poll_first(deque *deque);


void *peek_last(deque *deque);

void *peek_first(deque *deque);

void print_deque(deque* deque);


#endif //LOUTINE_DEQUE_H
